import 'package:wu_you/data/api/api.dart';
import 'package:wu_you/http/http.dart';
import 'package:wu_you/model/luck/luck_model.dart';

class LuckRepository{
  factory LuckRepository() => _getInstance();
  static LuckRepository _instance;

  LuckRepository._internal();

  static LuckRepository _getInstance() {
    if (_instance == null) {
      _instance = LuckRepository._internal();
    }
    return _instance;
  }

  ///获取抽奖页信息
  Future<LuckInfoModel> getLuckPageInfo() async {
    Map<String, dynamic> mapResult = await Http().get(Api.luckPageInfo);
    LuckInfoModel lm = LuckInfoModel.fromJson(mapResult);
    return lm;
  }

  ///参与抽奖
  Future<dynamic> luckStart(String sn,String number) async {
    Map<String, dynamic> data = {
      "sn":sn,
      "number":number,
    };
    return await Http().post(Api.luckStart,data: data);
  }
}